import store from '../store'
import Axios from './axios'

export default {
  install(Vue) {
    Vue.$Vue = Vue
    Vue.use(Axios)
    //全局获取用户信息
    Vue.prototype.$getUserInfo = function () {
      return new Promise(
        function (resolve, reject) {
          Vue.prototype.$http.get("/work/api/userInfo").then(res => {
            let userInfo = res.data.data
            store.commit("updateUserInfo", {userInfo: userInfo})
            resolve(userInfo)
          }).catch(error => {
            reject(error)
          });
        }
      );
    }

  }
}
